package com.boesch.electroOffice.utils;

import javax.portlet.PortletContext;

import com.liferay.faces.portal.context.LiferayFacesContext;

public class PortalUtils {

	/**
	 * Returns the absolute URL for the portal. For example: http://localhost:8080
	 */
	public static String getPortalURL() {
		LiferayFacesContext context = LiferayFacesContext.getInstance();
		return context.getPortalURL();
	}
	
	public static String getPortalRealPath(String subfolders) {
		PortletContext pc = PortletUtils.getPortletContext();
		String realPath = pc.getRealPath(subfolders);
		return realPath.substring(0, realPath.indexOf("temp"));
	}
}
